USE [SONALIKA_BGK_UPDATED]
GO

/****** Object:  StoredProcedure [dbo].[SpSpareScarcityRpt]    Script Date: 05/24/2014 17:38:06 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SpSpareScarcityRpt]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SpSpareScarcityRpt]
GO

USE [SONALIKA_BGK_UPDATED]
GO

/****** Object:  StoredProcedure [dbo].[SpSpareScarcityRpt]    Script Date: 05/24/2014 17:38:06 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO





CREATE PROC [dbo].[SpSpareScarcityRpt] 
AS
BEGIN
SELECT 
       SPARE_PART_CODE
       ,SPARE_PART_DESCRIPTION
      ,QUANTITY
      ,SUB_TOTAL

      
 FROM SPARE_PURCHASES_SALES SPS
     INNER JOIN SPARE_PARTS SP ON SPS.SPARE_PART_ID=SP.SPARE_PART_ID
 WHERE SP.SPARE_STATUS=(SELECT MASTER_ID FROM MASTER WHERE MASTER_VALUE='ACTIVE')
END




GO


